<?php
	//mysql 查询
	
	header("Content-Type:text/html;charset=utf-8");   
	echo'<meta http-equiv="refresh" content="4">';  //定时刷新
	$link = @mysql_connect("localhost","root","root") or die("连接错误".mysql_error());
	mysql_select_db("test",$link);
	mysql_query("set names utf8");	
	
	//单次读取数据	
	/* $sql = "select * from user";
	$result = @mysql_query($sql) or die("错误：".mysql_error());
	
	$rs = mysql_fetch_array($result);
	echo $rs["uName"]."->".$rs["uTel"]."<br/>";
	
	$rs = mysql_fetch_array($result);
	echo $rs["uName"]."->".$rs["uTel"]; */
	 
	//循环读取
	$sql = "select * from user";
	$result = @mysql_query($sql) or die("错误：".mysql_error());
	while($rs = mysql_fetch_array($result))
	{
		echo $rs["uName"]."->".$rs["uTel"]."->".$rs["uEmail"]."<br/>";
	}
	$count = mysql_num_rows($result);
	echo "SQL执行的行数：".$count;
	mysql_close();
?>
